package com.twu.biblioteca.model;

/**
 * Created by madhu on 1/5/14.
 */
public class User {

    private String name;
    private String email;
    private String phoneNumber;
    private String libraryLoginNumber;

    private static User user;

    private User() {
    }

    private User(String name, String email, String phoneNumber, String libraryLoginNumber) {

        this.name = name;
        this.email = email;
        this.phoneNumber = phoneNumber;
        this.libraryLoginNumber = libraryLoginNumber;

    }

    public static User getInstance() {
        if(user==null) user = new User();
        return user;
    }

    public static User getInstance(String name, String email, String phoneNumber, String libraryLoginNumber) {
        if(user==null) user = new User(name, email, phoneNumber, libraryLoginNumber);
        return user;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public void setLibraryLoginNumber(String libraryLoginNumber) {
        this.libraryLoginNumber = libraryLoginNumber;
    }

    public String getName() {
        return name;
    }

    public String getEmail() {
        return email;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public String getLibraryLoginNumber() {
        return libraryLoginNumber;
    }

    public static boolean isLoggedIn() {
        if(user==null) return false;
        else return true;
    }

}
